CmdUtils.CreateCommand({
//to install this command, visit http://gist.github.com/21865
//code is part of http://code.google.com/p/tl-ubiquity-commands/
  name: "open-doi",
  takes: {"selected text": noun_arb_text},
  preview: function(pblock, directObject){
    if (directObject.text){
      var m = directObject.text.match(/(doi:)?.*?\b(10\.\d{4}\/\S+)/i);
      if (!m){pblock.innerHTML="The selection <pre>"+directObject.text+"</pre> does not include a recognized doi !";}
      else {pblock.innerHTML="press Return to go to the document associated with <i>"+m[2]+"</i>.";}
    } else {pblock.innerHTML="Select or type a text that includes a doi..."}
  },
  execute: function(directObject){
    if (directObject.text){
      var m = directObject.text.match(/(doi:)?.*?\b(10\.\d{4}\/\S+)/i);
      if (m){Utils.openUrlInBrowser("http://dx.doi.org/"+m[2])}
    }
  }
})